#pragma once 

#include "BlockingQueue.h"
#include "thread.h"


#include <deque>
#include "task.h"
#include <mutex>

#include <vector>
#include <memory>
#include <condition_variable>
namespace TinyRPC{
class ThreadPool : public Noncopyable{
public:
    ThreadPool(int numThreads);
    void push(const Task& t);
    void push(Task&& t);
    void quit();

private:
    void threadFunc();
private:
    std::deque<Task> m_taskQueue;
    std::vector<std::unique_ptr<Thread>> m_threads;
    int m_numThreads;
    bool m_quit;
    std::mutex m_mutex;
    std::condition_variable m_notEmptyCondition;
};

}